package com.scedu.controller;

import com.scedu.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/user")
public class UserController {
    //http://localhost:8080/user/t1?name=xiaoli
    @GetMapping("/t1")
    public String test1(User user, Model model){
        //接收前端参数
        System.out.println("接收到的user="+user);

        //将返回的结果返回到前端 通过model
        model.addAttribute("msg",user);
        //跳转视图
        return "/hello";
    }
}
